import { filesColumns } from './column';
import { filesTable } from './table';
import type { AxFiles } from '@/api/modules/ax/files/types';

type CardItem = {
  label: string;
  value: any;
};
interface CardData {
  id: number;
  raw?: AxFiles;
  items: CardItem[];
}

/**
 * @description: 拖拽开始，用于设置拖拽前的值
 * @param {CardData} item
 */
export const dragstart = (item: CardData) => {
  // 待完善逻辑
};

/**
 * @description: 拖拽结束
 * @param {CardData} item
 */
export const drop = (item: CardData) => {
  // 待完善逻辑
};

/**
 * @description: 单击选择卡片
 * @param {CardData} item 当前选择的值
 */
export const selectAxFiles = (item: CardData) => {
  if (!filesTable.value.keys.includes(item.id)) {
    filesTable.value.keys.push(item.id);
  } else {
    filesTable.value.keys = filesTable.value.keys.filter(e => e !== item.id);
  }
};
